```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dubbo容错机制解析 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.8;
        }
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .code-block {
            background: #2d2d2d;
            color: #f8f8f2;
            border-radius: 0.5rem;
            position: relative;
        }
        .code-copy {
            position: absolute;
            right: 0.5rem;
            top: 0.5rem;
            color: #9ca3af;
            cursor: pointer;
            transition: all 0.2s;
        }
        .code-copy:hover {
            color: #ffffff;
        }
        .feature-icon {
            width: 3rem;
            height: 3rem;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 0.75rem;
            margin-bottom: 1rem;
        }
        .strategy-card {
            border-left: 4px solid;
            transition: all 0.3s ease;
        }
        .strategy-card:hover {
            transform: translateX(5px);
        }
        .mermaid-tooltip {
            position: absolute;
            background: white;
            padding: 8px;
            border-radius: 4px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
            z-index: 100;
            display: none;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-4 leading-tight">Dubbo容错机制解析</h1>
                    <p class="text-xl text-indigo-100 mb-8">构建高可用分布式系统的关键保障</p>
                    <div class="flex items-center">
                        <div class="w-12 h-1 bg-indigo-300 mr-4"></div>
                        <p class="text-indigo-200">技术小馆出品</p>
                    </div>
                </div>
                <div class="md:w-1/2 flex justify-center">
                    <div class="relative">
                        <div class="w-64 h-64 bg-white bg-opacity-10 rounded-full absolute -top-4 -left-4"></div>
                        <div class="w-64 h-64 bg-white bg-opacity-5 rounded-full absolute -bottom-4 -right-4"></div>
                        <div class="relative z-10">
                            <img src="https://dubbo.apache.org/imgs/dubbo-architecture.png" alt="Dubbo Architecture" class="rounded-lg shadow-2xl w-full max-w-md">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Introduction Section -->
    <section class="py-16 px-4 bg-white">
        <div class="container mx-auto max-w-4xl">
            <div class="text-center mb-12">
                <span class="inline-block px-3 py-1 text-sm font-semibold text-indigo-600 bg-indigo-100 rounded-full mb-4">系统设计</span>
                <h2 class="text-3xl font-bold text-gray-800 mb-4">容错机制概述</h2>
                <p class="text-gray-600 max-w-2xl mx-auto">在分布式系统中，服务间的调用可能会因为网络、服务提供者等各种原因失败。Dubbo提供了完善的容错机制来保证系统的可靠性和稳定性。</p>
            </div>
            
            <div class="grid md:grid-cols-3 gap-8 mb-12">
                <div class="bg-gray-50 p-6 rounded-xl text-center">
                    <div class="feature-icon bg-indigo-100 text-indigo-600 mx-auto">
                        <i class="fas fa-shield-alt text-xl"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-2">提高系统可靠性</h3>
                    <p class="text-gray-600">在服务调用失败时自动处理，减少对系统的影响</p>
                </div>
                <div class="bg-gray-50 p-6 rounded-xl text-center">
                    <div class="feature-icon bg-purple-100 text-purple-600 mx-auto">
                        <i class="fas fa-user-check text-xl"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-2">提升用户体验</h3>
                    <p class="text-gray-600">尽可能避免因服务不可用导致的用户请求失败</p>
                </div>
                <div class="bg-gray-50 p-6 rounded-xl text-center">
                    <div class="feature-icon bg-blue-100 text-blue-600 mx-auto">
                        <i class="fas fa-project-diagram text-xl"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-2">保证系统稳定性</h3>
                    <p class="text-gray-600">防止系统因单个服务失败而崩溃</p>
                </div>
            </div>
            
            <div class="bg-indigo-50 border-l-4 border-indigo-500 p-6 rounded-r-lg mb-8">
                <div class="flex">
                    <div class="flex-shrink-0">
                        <i class="fas fa-info-circle text-indigo-500 text-xl"></i>
                    </div>
                    <div class="ml-3">
                        <h3 class="text-sm font-medium text-indigo-800">实现方式</h3>
                        <div class="mt-2 text-sm text-indigo-700">
                            <p>Dubbo提供多种配置选项和策略来实现容错，可以在服务提供者和消费者之间的调用中进行灵活配置。</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Strategies Section -->
    <section class="py-16 px-4 bg-gray-50">
        <div class="container mx-auto max-w-4xl">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold text-gray-800 mb-4">常见容错策略</h2>
                <p class="text-gray-600 max-w-2xl mx-auto">根据不同的业务场景，Dubbo提供了多种容错策略以适应不同的需求。</p>
            </div>
            
            <!-- Visualization -->
            <div class="mb-16 bg-white p-6 rounded-xl shadow-sm">
                <div class="flex justify-between items-center mb-4">
                    <h3 class="text-xl font-semibold text-gray-800">容错策略关系图</h3>
                    <span class="text-sm text-gray-500">点击节点查看详情</span>
                </div>
                <div class="mermaid">
                    graph TD
                        A[Dubbo容错机制] --> B[Failover<br/>失败自动切换]
                        A --> C[Failback<br/>失败回退]
                        A --> D[Failfast<br/>失败快速返回]
                        A --> E[Failsafe<br/>失败安全]
                        A --> F[Circuit Breaker<br/>熔断器]
                        
                        click B "javascript:showStrategy('failover')" "Failover"
                        click C "javascript:showStrategy('failback')" "Failback"
                        click D "javascript:showStrategy('failfast')" "Failfast"
                        click E "javascript:showStrategy('failsafe')" "Failsafe"
                        click F "javascript:showStrategy('circuit-breaker')" "Circuit Breaker"
                </div>
                <div id="strategy-tooltip" class="mermaid-tooltip"></div>
            </div>
            
            <!-- Failover -->
            <div id="failover" class="strategy-card bg-white p-6 rounded-lg shadow-sm mb-8 border-l-indigo-500">
                <div class="flex items-start">
                    <div class="flex-shrink-0 h-10 w-10 rounded-full bg-indigo-100 flex items-center justify-center text-indigo-600 mr-4">
                        <i class="fas fa-sync-alt"></i>
                    </div>
                    <div>
                        <h3 class="text-xl font-semibold text-gray-800 mb-2">Failover（失败自动切换）</h3>
                        <p class="text-gray-600 mb-4">在调用失败时，自动切换到其他可用的服务提供者进行重试。可以配置最大重试次数。</p>
                        
                        <div class="bg-gray-100 p-4 rounded-lg mb-4">
                            <h4 class="font-medium text-gray-700 mb-2">适用场景</h4>
                            <p class="text-gray-600">服务提供者可能会临时出现故障的场景。例如，服务提供者因网络问题导致的短暂不可用。</p>
                        </div>
                        
                        <div class="code-block p-4 rounded-lg mb-4">
                            <div class="code-copy" onclick="copyCode(this)">
                                <i class="far fa-copy"></i>
                            </div>
                            <pre class="overflow-x-auto"><code class="language-xml">&lt;dubbo:reference id="myService" interface="com.ts.MyService" 
                 failover="true" retries="3"/&gt;</code></pre>
                        </div>
                        
                        <div class="grid md:grid-cols-2 gap-4">
                            <div class="bg-green-50 p-4 rounded-lg border border-green-100">
                                <h4 class="font-medium text-green-700 mb-2 flex items-center">
                                    <i class="fas fa-check-circle mr-2"></i>优点
                                </h4>
                                <p class="text-green-600">简单易用，能够处理服务提供者的临时故障。</p>
                            </div>
                            <div class="bg-red-50 p-4 rounded-lg border border-red-100">
                                <h4 class="font-medium text-red-700 mb-2 flex items-center">
                                    <i class="fas fa-exclamation-circle mr-2"></i>缺点
                                </h4>
                                <p class="text-red-600">可能会增加系统负载，导致重试的请求增加。</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Failback -->
            <div id="failback" class="strategy-card bg-white p-6 rounded-lg shadow-sm mb-8 border-l-purple-500">
                <div class="flex items-start">
                    <div class="flex-shrink-0 h-10 w-10 rounded-full bg-purple-100 flex items-center justify-center text-purple-600 mr-4">
                        <i class="fas fa-history"></i>
                    </div>
                    <div>
                        <h3 class="text-xl font-semibold text-gray-800 mb-2">Failback（失败回退）</h3>
                        <p class="text-gray-600 mb-4">在调用失败时，不会立即进行重试，而是记录失败的请求并在后台定期进行重试。</p>
                        
                        <div class="bg-gray-100 p-4 rounded-lg mb-4">
                            <h4 class="font-medium text-gray-700 mb-2">适用场景</h4>
                            <p class="text-gray-600">请求的结果不是实时需要的场景，例如数据同步。</p>
                        </div>
                        
                        <div class="code-block p-4 rounded-lg mb-4">
                            <div class="code-copy" onclick="copyCode(this)">
                                <i class="far fa-copy"></i>
                            </div>
                            <pre class="overflow-x-auto"><code class="language-xml">&lt;dubbo:reference id="myService" interface="com.ts.MyService" 
                 failback="true"/&gt;</code></pre>
                        </div>
                        
                        <div class="grid md:grid-cols-2 gap-4">
                            <div class="bg-green-50 p-4 rounded-lg border border-green-100">
                                <h4 class="font-medium text-green-700 mb-2 flex items-center">
                                    <i class="fas fa-check-circle mr-2"></i>优点
                                </h4>
                                <p class="text-green-600">可以减少对实时请求的影响，适用于延迟容忍的场景。</p>
                            </div>
                            <div class="bg-red-50 p-4 rounded-lg border border-red-100">
                                <h4 class="font-medium text-red-700 mb-2 flex items-center">
                                    <i class="fas fa-exclamation-circle mr-2"></i>缺点
                                </h4>
                                <p class="text-red-600">请求的失败处理延迟，可能会造成用户体验不佳。</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Failfast -->
            <div id="failfast" class="strategy-card bg-white p-6 rounded-lg shadow-sm mb-8 border-l-blue-500">
                <div class="flex items-start">
                    <div class="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 mr-4">
                        <i class="fas fa-bolt"></i>
                    </div>
                    <div>
                        <h3 class="text-xl font-semibold text-gray-800 mb-2">Failfast（失败快速返回）</h3>
                        <p class="text-gray-600 mb-4">在调用失败时，立即返回失败结果，不进行重试。</p>
                        
                        <div class="bg-gray-100 p-4 rounded-lg mb-4">
                            <h4 class="font-medium text-gray-700 mb-2">适用场景</h4>
                            <p class="text-gray-600">请求的失败会导致系统级的错误或不能容忍的场景。例如，服务调用涉及到的数据不可用。</p>
                        </div>
                        
                        <div class="code-block p-4 rounded-lg mb-4">
                            <div class="code-copy" onclick="copyCode(this)">
                                <i class="far fa-copy"></i>
                            </div>
                            <pre class="overflow-x-auto"><code class="language-xml">&lt;dubbo:reference id="myService" interface="com.ts.MyService" 
                 failfast="true"/&gt;</code></pre>
                        </div>
                        
                        <div class="grid md:grid-cols-2 gap-4">
                            <div class="bg-green-50 p-4 rounded-lg border border-green-100">
                                <h4 class="font-medium text-green-700 mb-2 flex items-center">
                                    <i class="fas fa-check-circle mr-2"></i>优点
                                </h4>
                                <p class="text-green-600">可以迅速检测服务的不可用状态，减少系统负担。</p>
                            </div>
                            <div class="bg-red-50 p-4 rounded-lg border border-red-100">
                                <h4 class="font-medium text-red-700 mb-2 flex items-center">
                                    <i class="fas fa-exclamation-circle mr-2"></i>缺点
                                </h4>
                                <p class="text-red-600">无法处理偶发的服务提供者问题，可能导致部分请求失败。</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Failsafe -->
            <div id="failsafe" class="strategy-card bg-white p-6 rounded-lg shadow-sm mb-8 border-l-yellow-500">
                <div class="flex items-start">
                    <div class="flex-shrink-0 h-10 w-10 rounded-full bg-yellow-100 flex items-center justify-center text-yellow-600 mr-4">
                        <i class="fas fa-shield-virus"></i>
                    </div>
                    <div>
                        <h3 class="text-xl font-semibold text-gray-800 mb-2">Failsafe（失败安全）</h3>
                        <p class="text-gray-600 mb-4">在调用失败时，记录失败日志，但不返回错误结果给用户。通常用于系统内部的非核心操作。</p>
                        
                        <div class="bg-gray-100 p-4 rounded-lg mb-4">
                            <h4 class="font-medium text-gray-700 mb-2">适用场景</h4>
                            <p class="text-gray-600">日志记录、统计等不影响核心业务逻辑的场景。</p>
                        </div>
                        
                        <div class="code-block p-4 rounded-lg mb-4">
                            <div class="code-copy" onclick="copyCode(this)">
                                <i class="far fa-copy"></i>
                            </div>
                            <pre class="overflow-x-auto"><code class="language-xml">&lt;dubbo:reference id="myService" interface="com.ts.MyService" 
                 failsafe="true"/&gt;</code></pre>
                        </div>
                        
                        <div class="grid md:grid-cols-2 gap-4">
                            <div class="bg-green-50 p-4 rounded-lg border border-green-100">
                                <h4 class="font-medium text-green-700 mb-2 flex items-center">
                                    <i class="fas fa-check-circle mr-2"></i>优点
                                </h4>
                                <p class="text-green-600">能够保护核心业务逻辑不受影响，同时记录失败信息用于后续处理。</p>
                            </div>
                            <div class="bg-red-50 p-4 rounded-lg border border-red-100">
                                <h4 class="font-medium text-red-700 mb-2 flex items-center">
                                    <i class="fas fa-exclamation-circle mr-2"></i>缺点
                                </h4>
                                <p class="text-red-600">无法给用户反馈请求失败的原因，可能影响用户体验。</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Circuit Breaker -->
            <div id="circuit-breaker" class="strategy-card bg-white p-6 rounded-lg shadow-sm mb-8 border-l-red-500">
                <div class="flex items-start">
                    <div class="flex-shrink-0 h-10 w-10 rounded-full bg-red-100 flex items-center justify-center text-red-600 mr-4">
                        <i class="fas fa-traffic-light"></i>
                    </div>
                    <div>
                        <h3 class="text-xl font-semibold text-gray-800 mb-2">Circuit Breaker（熔断器）</h3>
                        <p class="text-gray-600 mb-4">监控服务调用的健康状态，当检测到服务异常时，熔断器会打开，暂时停止对该服务的请求，避免服务过载。</p>
                        
                        <div class="bg-gray-100 p-4 rounded-lg mb-4">
                            <h4 class="font-medium text-gray-700 mb-2">适用场景</h4>
                            <p class="text-gray-600">需要保护系统稳定性，防止服务故障蔓延的场景。</p>
                        </div>
                        
                        <div class="bg-yellow-50 border-l-4 border-yellow-500 p-6 rounded-r-lg mb-4">
                            <div class="flex">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-exclamation-triangle text-yellow-500 text-xl"></i>
                                </div>
                                <div class="ml-3">
                                    <h3 class="text-sm font-medium text-yellow-800">注意</h3>
                                    <div class="mt-2 text-sm text-yellow-700">
                                        <p>Circuit Breaker 需要在代码中实现或通过第三方库集成，Dubbo 本身不直接提供熔断器功能。</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <div class="grid md:grid-cols-2 gap-4">
                            <div class="bg-green-50 p-4 rounded-lg border border-green-100">
                                <h4 class="font-medium text-green-700 mb-2 flex items-center">
                                    <i class="fas fa-check-circle mr-2"></i>优点
                                </h4>
                                <p class="text-green-600">可以有效防止故障蔓延，保护系统稳定性。</p>
                            </div>
                            <div class="bg-red-50 p-4 rounded-lg border border-red-100">
                                <h4 class="font-medium text-red-700 mb-2 flex items-center">
                                    <i class="fas fa-exclamation-circle mr-2"></i>缺点
                                </h4>
                                <p class="text-red-600">熔断器打开期间，可能导致部分请求失败。</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Configuration Section -->
            <div class="bg-white p-6 rounded-lg shadow-sm">
                <h3 class="text-2xl font-semibold text-gray-800 mb-4">配置容错策略</h3>
                
                <div class="grid md:grid-cols-2 gap-8">
                    <div>
                        <h4 class="text-lg font-medium text-gray-700 mb-2 flex items-center">
                            <i class="fas fa-cog text-indigo-500 mr-2"></i>在服务消费者端配置
                        </h4>
                        <p class="text-gray-600">容错策略通常在服务消费者端进行配置，通过 <code class="bg-gray-100 px-1 rounded">dubbo:reference</code> 标签中的属性来设置。</p>
                    </div>
                    <div>
                        <h4 class="text-lg font-medium text-gray-700 mb-2 flex items-center">
                            <i class="fas fa-filter text-purple-500 mr-2"></i>策略选择
                        </h4>
                        <p class="text-gray-600">根据实际业务场景和需求选择合适的容错策略，例如，服务重要性、请求实时性、系统稳定性要求等。</p>
                    </div>
                </div>
                
                <div class="mt-6 bg-indigo-50 p-4 rounded-lg">
                    <div class="flex">
                        <div class="flex-shrink-0">
                            <i class="fas fa-lightbulb text-indigo-500 text-xl"></i>
                        </div>
                        <div class="ml-3">
                            <h3 class="text-sm font-medium text-indigo-800">最佳实践</h3>
                            <div class="mt-2 text-sm text-indigo-700">
                                <p>对于关键业务服务，建议结合使用Failover和Circuit Breaker策略；对于非关键服务，可以使用Failsafe策略减少对核心业务的影响。</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-8 px-4">
        <div class="container mx-auto max-w-6xl">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold">技术小馆</h3>
                    <p class="text-gray-400 mt-1">专注分享高质量技术内容</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-indigo-300 hover:text-indigo-100 transition-colors duration-200 flex items-center">
                        <i class="fas fa-external-link-alt mr-2"></i>
                        <span>访问我们的语雀知识库</span>
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-6 pt-6 text-center text-gray-500 text-sm">
                <p>© 2023 技术小馆. 保留所有权利.</p>
            </div>
        </div>
    </footer>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // Show strategy tooltip
        function showStrategy(strategy) {
            const strategyElement = document.getElementById(strategy);
            if (strategyElement) {
                strategyElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
                
                // Add highlight effect
                strategyElement.classList.add('ring-2', 'ring-indigo-500');
                setTimeout(() => {
                    strategyElement.classList.remove('ring-2', 'ring-indigo-500');
                }, 2000);
            }
        }
        
        // Copy code block
        function copyCode(button) {
            const codeBlock = button.nextElementSibling;
            const range = document.createRange();
            range.selectNode(codeBlock);
            window.getSelection().removeAllRanges();
            window.getSelection().addRange(range);
            document.execCommand('copy');
            window.getSelection().removeAllRanges();
            
            // Show copied feedback
            const originalIcon = button.innerHTML;
            button.innerHTML = '<i class="fas fa-check"></i>';
            button.classList.add('text-green-400');
            setTimeout(() => {
                button.innerHTML = originalIcon;
                button.classList.remove('text-green-400');
            }, 2000);
        }
    </script>
</body>
</html>
```